package com.bilibili.juc.cas;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author zuife
 * @description
 * @since 2024-05-02 22:17:55
 */
public class CASDemo {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.compareAndSet(5, 2019)+"\t current data:"+atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 1024)+"\t current data:"+atomicInteger.get());
        atomicInteger.getAndAdd(10);
        System.out.println("current data:"+atomicInteger.get());

    }
}
